home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-05 / driverss.zip / HPPCLAN.ASM < prev    next >
Assembly Source File  |  1991-02-06  |  17KB  |  743 lines

  1. version    equ    0
  2. ;History:349,1
  3.  
  4. ;  Russell Nelson, Clarkson University.
  5. ;  Copyright, 1988-1991, Russell Nelson
  6. ;  The following people have contributed to this code: David Horne, Eric
  7. ;  Henderson, and Bob Clements.
  8.  
  9. ;   This program is free software; you can redistribute it and/or modify
  10. ;   it under the terms of the GNU General Public License as published by
  11. ;   the Free Software Foundation, version 1.
  12. ;
  13. ;   This program is distributed in the hope that it will be useful,
  14. ;   but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. ;   GNU General Public License for more details.
  17. ;
  18. ;   You should have received a copy of the GNU General Public License
  19. ;   along with this program; if not, write to the Free Software
  20. ;   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22.     include    defs.asm
  23.  
  24. code    segment    word public
  25.     assume    cs:code, ds:code
  26.  
  27. ;*****************************************************************************
  28. ;
  29. ;    hppclan controller board offsets
  30. ;    IO port definition (BASE in io_addr)
  31. ;*****************************************************************************
  32. NE_DATAPORT    EQU    0ch        ; hppclan Port Window.
  33. HP_PROM        equ    00h
  34. HP_OPTION    equ    08h
  35. EN_OFF        equ    10h
  36.  
  37. ENDCFG_BM8    equ    48h
  38.  
  39. OPTION_RUN    equ    01h
  40. OPTION_DATA    equ    10h
  41.  
  42.     include    8390.inc
  43.  
  44. ; Shared memory management parameters
  45.  
  46. SM_TSTART_PG    EQU    0h        ; First page of TX buffer
  47. SM_RSTART_PG    EQU    6h        ; start at page 6
  48. SM_RSTOP_PG    EQU    80h        ; end at page 80
  49.  
  50. pause_    macro
  51. ;    jmp    $+2
  52. endm
  53.  
  54. longpause macro
  55.     push    cx
  56.     mov    cx,0
  57.     loop    $
  58.     pop    cx
  59. endm
  60.  
  61. ram_enable    macro
  62.     endm
  63.  
  64. mc_chan_on    macro
  65.     mov    al,chan_sel
  66.     mov    dx,96h
  67.     out    dx,al            ; select channel
  68.  
  69.     mov    dx,94h
  70.     mov    al,0a0h            
  71.     out    dx,al            ; protect system board
  72.  
  73.     mov    dx,102h            ; point dx at option reg
  74. endm
  75.  
  76. mc_chan_off    macro
  77.     mov    dx,96h
  78.     xor    al,al
  79.     out    dx,al
  80. endm
  81.  
  82. reset_8390    macro
  83.     local   reset_8390_1
  84.     local   is_mc_b
  85.     local    not_mc_c
  86.     local    not_mc_d
  87.  
  88.     test    sys_features,MICROCHANNEL
  89.     jne    is_mc_b
  90.     jmp    not_mc_c
  91. is_mc_b:
  92.     mc_chan_on
  93.     in    al,dx            ;capture and save option register
  94.     and    al, not OPTION_RUN    ;reset the 8390
  95.     out    dx,al
  96.     longpause
  97.     or    al, OPTION_RUN        ;turn it back on
  98.     out    dx,al        
  99.     mc_chan_off
  100.     loadport            ;Set DX the way we expect it
  101.     setport    HP_OPTION        
  102.     jmp    not_mc_d
  103.  
  104. not_mc_c:
  105.     loadport
  106.     setport    HP_OPTION        ;hard reset 8390.
  107.     xor    al,al            ;reset the 8390
  108.     out    dx,al
  109.     longpause
  110.     mov    al,int_no        ;get our interrupt number, and
  111.     cmp    al,9            ;is it really interrupt 2?
  112.     jne    reset_8390_1
  113.     mov    al,2
  114. reset_8390_1:
  115.     shl    al,1            ;put it where we need it
  116.     or    al, OPTION_RUN        ;turn it back on
  117.     out    dx,al        
  118.  
  119. not_mc_d:
  120.     endm
  121.  
  122. terminate_board    macro
  123.     local is_mc_a
  124.     local not_mc_a
  125.     local not_mc_b
  126.     test    sys_features,MICROCHANNEL
  127.     jne    is_mc_a
  128.     jmp    not_mc_a
  129.  
  130. is_mc_a:
  131.     in    al,dx            ;capture and save option register
  132.     and    al, not OPTION_RUN    ;reset the 8390
  133.     out    dx,al
  134.     mc_chan_off
  135.     loadport            ;Set DX the way we expect it
  136.     setport    HP_OPTION        
  137.     jmp    not_mc_b
  138.  
  139. not_mc_a:
  140.     loadport
  141.     setport    HP_OPTION        ;hard reset 8390.
  142.     xor    al,al
  143.     out    dx,al
  144. not_mc_b:
  145.     endm
  146.  
  147.     extrn    sys_features: byte
  148.  
  149.     extrn    set_recv_isr: near
  150.  
  151. ;enter with si -> argument string, di -> word to store.
  152. ;if there is no number, don't change the number.
  153.     extrn    get_number: near
  154.  
  155. ;enter with dx -> name of word, di -> dword to print.
  156.     extrn    print_number: near
  157.  
  158. ;enter with al = single character
  159.     extrn    chrout: near
  160.  
  161.     public    int_no, io_addr
  162. int_no        db    3,0,0,0        ;must be four bytes long for get_number.
  163. io_addr        dw    0300h,0        ; I/O address for card (jumpers)
  164.  
  165.     public    driver_class, driver_type, driver_name, driver_function, parameter_list
  166. driver_class    db    BLUEBOOK, IEEE8023, 0        ;from the packet spec
  167. driver_type    db    ?        ;Wild card matches any type
  168. driver_name    db    "HP ",20 dup(?)    ;name of the driver.
  169. driver_function    db    2
  170. parameter_list    label    byte
  171.     db    1    ;major rev of packet driver
  172.     db    9    ;minor rev of packet driver
  173.     db    14    ;length of parameter list
  174.     db    EADDR_LEN    ;length of MAC-layer address
  175.     dw    GIANT    ;MTU, including MAC headers
  176.     dw    MAX_MULTICAST * EADDR_LEN    ;buffer size of multicast addrs
  177.     dw    0    ;(# of back-to-back MTU rcvs) - 1
  178.     dw    0    ;(# of successive xmits) - 1
  179. int_num    dw    0    ;Interrupt # to hook for post-EOI
  180.             ;processing, 0 == none,
  181.  
  182. is_186        db    0
  183.  
  184. chan_sel    db    0    ;Channel select for MICROCHANNEL machines
  185. ;
  186. ;    Special case Block input routine. Used on extra memory
  187. ;    space for board ID etc. DMA count is set X2,
  188. ;    CX = byte count, es:si = buffer location, ax = buffer address
  189. ;
  190. sp_block_input:
  191. ;    Nothing special needed for hppclan
  192. ;
  193. ;    Block input routine
  194. ;    CX = byte count, es:si = buffer location, ax = buffer address
  195.  
  196.     public    block_input
  197. block_input:
  198.     push    ax            ; save buffer address
  199.  
  200.     loadport
  201.     setport    HP_OPTION        
  202.     test    sys_features,MICROCHANNEL
  203.     je    not_mc_1
  204.     jmp    is_mc_1
  205. not_mc_1:
  206.     in    al,dx
  207.     or    al,OPTION_DATA        ;Enable the data port except on MCA
  208.     out    dx,al
  209.  
  210. is_mc_1:
  211.     setport EN_CCMD
  212.     pause_
  213.     mov    al,ENC_NODMA+ENC_PAGE0+ENC_START
  214.     out    dx,al
  215.     setport    EN0_RCNTLO    ; remote byte count 0
  216.     pause_
  217.     mov    al,cl
  218.     out    dx,al
  219.     setport    EN0_RCNTHI
  220.     pause_
  221.     mov    al,ch
  222.     out    dx,al
  223.     pop    ax        ; get our page back
  224.     setport    EN0_RSARLO
  225.     pause_
  226.     out    dx,al        ; set as hi address
  227.     setport    EN0_RSARHI
  228.     pause_
  229.     mov    al,ah
  230.     out    dx,al
  231.     setport EN_CCMD
  232.     pause_
  233.     mov    al,ENC_RREAD+ENC_START    ; read and start
  234.     out    dx,al
  235.     setport    NE_DATAPORT
  236.     pause_
  237.     cmp    is_186,0
  238.     jnz    read_186
  239.     shr    cx,1
  240. read_loop:
  241.     in    ax,dx        ; get a word
  242.     stosw            ; save it
  243.     loop    read_loop
  244.     jnc    read_done
  245.     in    al,dx
  246.     stosb
  247.     jmp    short read_done
  248. read_186:
  249.     shr    cx,1
  250.     db    0f3h, 06dh    ;masm 4.0 doesn't grok "rep insw"
  251.     jnc    read_done
  252.     db    06ch        ;masm 4.0 doesn't grok "insb"
  253. read_done:
  254.     setport    HP_OPTION
  255.     test    sys_features,MICROCHANNEL
  256.     je    not_mc_2
  257.     ret
  258. not_mc_2:
  259.     in    al,dx
  260.     and    al,not OPTION_DATA
  261.     out    dx,al
  262.     ret
  263. ;
  264. ;    Block output routine
  265. ;    CX = byte count, ds:si = buffer location, ax = buffer address
  266.  
  267.  
  268. block_output:
  269.     assume    ds:nothing
  270.     push    ax        ; save buffer address
  271.  
  272.     loadport
  273.     setport    HP_OPTION
  274.     test    sys_features,MICROCHANNEL
  275.     je    not_mc_3
  276.     jmp    is_mc_3
  277. not_mc_3:
  278.     in    al,dx
  279.     or    al,OPTION_DATA    ; enable the data port except on MCA
  280.     out    dx,al
  281.  
  282. is_mc_3:
  283.     inc    cx        ; make even
  284.     and    cx,0fffeh
  285.     setport EN_CCMD
  286.     pause_
  287.     mov    al,ENC_NODMA+ENC_START
  288.     out    dx,al        ; stop & clear the chip
  289.     setport    EN0_RCNTLO    ; remote byte count 0
  290.     pause_
  291.     mov    al,cl
  292.     out    dx,al
  293.     setport    EN0_RCNTHI
  294.     pause_
  295.     mov    al,ch
  296.     out    dx,al
  297.     pop    ax        ; get our page back
  298.     setport    EN0_RSARLO
  299.     pause_
  300.     out    dx,al        ; set as lo address
  301.     setport    EN0_RSARHI
  302.     pause_
  303.     mov    al,ah
  304.     out    dx,al
  305.     setport EN_CCMD
  306.     pause_
  307.     mov    al,ENC_RWRITE+ENC_START    ; write and start
  308.     out    dx,al
  309.     setport    NE_DATAPORT
  310.     pause_
  311.     shr    cx,1
  312.     cmp    is_186,0
  313.     jnz    write_186
  314. write_loop:
  315.     lodsw            ; get a word
  316.     out    dx,ax        ; save it
  317.     loop    write_loop
  318.     jmp    short write_done
  319. write_186:
  320.     db    0f3h, 06fh        ;masm 4.0 doesn't grok "rep outsw"
  321. write_done:
  322.     mov    cx,0
  323.     setport    EN0_ISR
  324. tx_check_rdc:
  325.     in    al,dx
  326.     test    al,ENISR_RDC    ; dma done ???
  327.     clc
  328.     jnz    tx_start
  329.     loop    tx_check_rdc
  330.     stc
  331. tx_start:
  332.     setport    HP_OPTION
  333.     test    sys_features,MICROCHANNEL
  334.     je    not_mc_4
  335.     ret
  336. not_mc_4:
  337.     lahf                ;save cy.
  338.     in    al,dx
  339.     and    al,not OPTION_DATA
  340.     out    dx,al
  341.     sahf                ;restore cy.
  342.     ret
  343.  
  344.     include    8390.asm
  345.  
  346.     public    usage_msg
  347. usage_msg    db    "usage: hppclan [-n] [-d] [-w] <packet_int_no> [<int_no> [<io_addr>]]",CR,LF
  348.  
  349.     public    copyright_msg
  350. copyright_msg    db    "Packet driver for HP PC LAN cards, version "
  351.         db    '0'+majver,".",'0'+version,".",'0'+dp8390_version,CR,LF,'$'
  352.  
  353. no_hp_msg    db    "No HP PC LAN card found (matching io_addr or int_no if spedified).",CR,LF,'$'
  354. cfg_err_msg    db    "Configuration failed. Check parameters.",CR,LF,'$'
  355. int_no_name    db    "Interrupt number ",'$'
  356. io_addr_name    db    "I/O port ",'$'
  357.  
  358. comment \
  359.  
  360. Here are the ID byte values for all released cards.  Bit 7 of the ID byte
  361. for AT cards indicates bus width (as well as RAM buffer size).
  362.  
  363. The ID byte was added to give a unique number to every revision of every card
  364. produced.  However, it is a little more than just a flat assignment; there is
  365. some fields.  For driver software it is assumed the driver knows what bus it
  366. is on (eg. AT verses MC):
  367.  
  368. The format of the ID byte (offset 0x07 from I/O base) is:
  369.  
  370.         7  6  5  4  3  2  1  0
  371.         a  b  b  b  c  c  c  c
  372. where,
  373.         "a"   is the AT bus width bit
  374.          0 =  8 bit AT cards (32K bytes of buffer RAM)
  375.          1 = 16 bit AT cards (64K bytes of buffer RAM)
  376.  
  377.         "bbb" is for board revisions
  378.  
  379.         "ccc" is the LAN Media type
  380.          000 = HP StarLAN-10
  381.          001 = 10-Base-T (Ethertwist)
  382.          002 = 10-Base-2 (ThinLAN)
  383.          ??? = reserved for future
  384.  
  385. The current ID bytes assigned are:
  386.         0x00 = (obsolete) HP27240 AT8  StarLAN
  387.         0x10 = (obsolete) HP24240 AT8  StarLAN rev B
  388.         0x00 = (obsolete) HP27241 MC16 StarLAN
  389.         0x01 = HP27245 AT8  10-Base-T
  390.         0x01 = HP27246 MC16 10-Base-T
  391.         0x02 = HP27250 AT8  ThinLAN
  392.         0x81 = HP27247 AT16 10-Base-T
  393.  
  394. NOTE:   All Microchannel cards are 16 bits wide.
  395.         All 8 bit cards have 32K bytes of buffer RAM.
  396.         All 16 bit cards (AT & MC) have 64K bytes of buffer RAM.
  397. \
  398.  
  399. this_board_msg    db    "This board is an HP",'$'
  400.  
  401. ISA_name_list    dw    board_00ISA, board_10, board_01ISA, board_02, board_81
  402.         dw    board_unk
  403. MCA_name_list    dw    board_00MCA, board_01MCA
  404.         dw    board_unk
  405.  
  406. board_00ISA    db    00h, "27240",0,60    ;AT8  StarLAN
  407. board_10    db    10h, "24240",0,60    ;AT8  StarLAN rev B
  408. board_00MCA    db    00h, "27241",0,60    ;MC16 StarLAN
  409. board_01ISA    db    01h, "27245",0,60    ;AT8  10-Base-T
  410. board_01MCA    db    01h, "27246",0,60    ;MC16 10-Base-T
  411. board_02    db    02h, "27250",0,60    ;AT8  ThinLAN
  412. board_81    db    81h, "27247",0,60    ;AT16 10-Base-T
  413. board_unk    db    -1h, "Unknown HP272xx",0,60    ;just a guess.
  414.  
  415. ; ISA DEFAULTS for io_addr and int_no,
  416. ; MCA DEFAULTS to first found.
  417.  
  418. DEF_IO_ADDR    equ    0300h    
  419. DEF_INT_NO    equ    3
  420.  
  421. MC_DEF_IO    equ    1
  422. MC_DEF_INT    equ    2
  423. MC_DEF_BOTH    equ    MC_DEF_IO+MC_DEF_INT
  424.  
  425. mc_def_req    db    0
  426.  
  427. int_no_table    db    3, 4, 5, 7, 9, 10, 11, 12
  428.  
  429. ; First 3 bytes of the LAN Addres will identify the board as HP
  430.  
  431. hp_vendor_id    db    08h,00h,09h
  432.  
  433.     public    parse_args
  434. parse_args:
  435. ;exit with nc if all went well, cy otherwise.
  436.     test    sys_features,MICROCHANNEL
  437.     jne    parse_args_mc
  438.     jmp    parse_args_1
  439.  
  440. parse_args_mc:
  441.  
  442. ; first determine if non-default values have been requested
  443. ; get_number will return requested value, -1, or carry flag set
  444.  
  445.     mov    di,offset int_no
  446.     call    get_number
  447.     mov    BYTE PTR [di+1], 0
  448.     mov    WORD PTR [di+2], 0
  449.     jnc    parse_args_mc2
  450.     mov    BYTE PTR [di], 0ffh    ; error return, use -1 value
  451.  
  452. parse_args_mc2:
  453.     mov    di,offset io_addr
  454.     call    get_number
  455.     mov    WORD PTR [di+2], 0
  456.     jnc    parse_args_mc3
  457.     mov    WORD PTR [di], 0ffffh    ; error return, use -1 value
  458.  
  459. parse_args_mc3:
  460.     
  461.     xor    al,al
  462.     cmp    io_addr,0ffffh
  463.     jne    parse_args_mc4
  464.     mov    al,MC_DEF_IO
  465.  
  466. parse_args_mc4:
  467.     cmp    int_no,0ffh
  468.     jne    parse_args_mc5
  469.     or    al,MC_DEF_INT
  470.  
  471. parse_args_mc5:
  472.     mov    mc_def_req,al
  473.  
  474. ;The following code to read the POS registers is courtesy of Racal-Interlan.
  475.  
  476. ; channel selector resides at io 96h
  477. ; POS register base is at io 100h
  478.  
  479. ; search thro' the slots for a 9210 card
  480.     mov    cx, 8            ; for all channels(slots)
  481.  
  482. ; channel select value for slots 0,1,2.. is 8,9,A etc
  483. ; start with slot 0, and then 7,6,5,4,3,2,1
  484.  
  485. get_01:
  486.     mov    ax, cx            ; channel number
  487.     or    ax, 08h            ; reg. select value
  488.     mov    chan_sel,al        ; save each one, the LAST will right
  489.     mov    dx, 96h            ; channel select register
  490.     out    dx, al            ; select channel
  491.  
  492.     mov    dx, 94h            ; protect system board
  493.     mov    al, 0a0h
  494.     out    dx, al            
  495.  
  496. ; read adapter id
  497.     mov    dx, 100h
  498.     in    al, dx            ; adapter id - ms byte
  499.     mov    ah, al
  500.     inc    dx
  501.     in    al, dx            ; adapter id - ls byte
  502.  
  503. ; Check if HP
  504.     cmp    ax, 0ca63h
  505.     je    get_03
  506.     
  507. get_02:
  508.     ; come back to here if card found does not match user 
  509.     ; requirements below
  510.  
  511.     loop    get_01
  512.  
  513.     mc_chan_off
  514.     mov    dx,offset no_hp_msg
  515.     jmp    error
  516.  
  517. get_03:        ; found an HP adapter, is it the right one?
  518.  
  519. comment \
  520.  
  521. The only POS registers defined for the Microchannel card (HP27246) are:
  522.  
  523.         0x100 = Adapter Identification LSB (0xCA) Read only
  524.         0x101 = Adapter Identification MSB (0x63) Read only
  525.         0x102 = Option Register Read/Write
  526.  
  527. The Option register bits are defined as:
  528.  
  529.         7 6 5 4 3 2 1 0
  530.         a a a - b b b c
  531.  
  532. where,
  533.         "aaa" is the I/O Base Address Relocation bits
  534.          000 = 0x0400 to 0x041f
  535.          001 = 0x1400 to 0x141f
  536.          010 = 0x2400 to 0x241f
  537.          011 = 0x3400 to 0x341f
  538.          100 = 0x4400 to 0x441f
  539.          101 = 0x5400 to 0x541f
  540.          110 = 0x6400 to 0x641f
  541.          111 = 0x7400 to 0x741f
  542.  
  543.  
  544.         "bbb" is the Interrupt Level bits
  545.          000 = INT 3
  546.          001 = INT 4
  547.          010 = INT 5
  548.          011 = INT 7
  549.          100 = INT 9
  550.          101 = INT 10
  551.          110 = INT 11
  552.          111 = INT 12
  553.  
  554.         "c" is the Card Enable / NIC Reset bit
  555.          0 = NIC held in reset (eg. cannot access its registers)
  556.          1 = NIC not reset (eg. regster can be accessed)
  557.          NOTE: Access to the PROM should only occur while NIC is held in reset.
  558.  
  559. \
  560.  
  561.     mov    dx,102h
  562.     in    al,dx
  563.     and    ax,00e0h        ;leave only the base address bits
  564.     push    cx
  565.     mov    cl,12-5            ;now ends at bit 5, should end at bit 12
  566.     shl    ax,cl
  567.     pop    cx
  568.     or    ax,400h
  569.     mov    di,ax        ; temporary save
  570.  
  571.     in    al,dx
  572.     shr    al,1
  573.     and    al,7
  574.     mov    bl,al
  575.     xor    bh,bh
  576.     mov    al,int_no_table[bx]
  577.  
  578.     ; check for matches with user selects
  579.  
  580.     mov    ah,mc_def_req
  581.     test    ah,MC_DEF_IO
  582.     jz    get_04
  583.     mov    io_addr,di    ; user wants default, copy temp address
  584.  
  585. get_04:
  586.     test    ah,MC_DEF_INT
  587.     jz    get_05
  588.     mov    int_no,al    ; user wants default, copy temp int number
  589.  
  590. get_05:    
  591.     cmp    di,io_addr
  592.     je     get_06
  593.     jmp    get_02        ; correct io_addr not found, keep looking
  594.  
  595. get_06:    
  596.     cmp    al,int_no
  597.     je     get_07
  598.     jmp    get_02        ; correct io_addr not found, keep looking
  599.  
  600. get_07:        ; if we get here we now have the io_addr and int_no
  601.         ; that the user wanted
  602.     mc_chan_off
  603.     jmp parse_args_5
  604.  
  605. ;
  606. ; Much simpler code for ISA machine parse_args
  607. ;
  608. parse_args_1:
  609.     mov    di,offset int_no
  610.     call    get_number
  611.     jc    parse_args_2
  612.     cmp    WORD PTR [di],0
  613.     jl    parse_args_2
  614.     jmp    parse_args_3
  615.  
  616. parse_args_2:
  617.     mov    WORD PTR [di],DEF_INT_NO
  618.     mov    WORD PTR [di+2],0
  619.  
  620. parse_args_3:
  621.     mov    di,offset io_addr
  622.     call    get_number
  623.     jc    parse_args_4
  624.     cmp    WORD PTR [di],0
  625.     jl    parse_args_4
  626.     jmp    parse_args_5
  627.  
  628. parse_args_4:
  629.     mov    WORD PTR [di],DEF_IO_ADDR
  630.     mov    WORD PTR [di+2],0
  631.  
  632. parse_args_5:    ;Finally verify HP Vendor ID in 1st 3 bytes of station addr
  633.     loadport
  634.     setport    HP_PROM
  635.     mov    di,offset hp_vendor_id
  636.     mov    cx,3
  637. id_card_loop:
  638.     in    al,dx
  639.     cmp    al, BYTE PTR [di]
  640.     je    id_card_loop1
  641.     mov    dx,offset no_hp_msg
  642.     jmp    error
  643.  
  644. id_card_loop1:
  645.     inc    di
  646.     inc    dx
  647.     loop    id_card_loop
  648.     clc
  649.     ret
  650.  
  651.  
  652.     extrn    etopen_diagn: byte
  653.  
  654. init_card:
  655. ;Read PROM contents
  656.     loadport
  657.     setport    HP_PROM
  658.     mov    di,offset curr_hw_addr
  659.     mov    ax,cs
  660.     mov    es,ax
  661.     mov    cx,EADDR_LEN
  662.     xor    ah,ah
  663. init_card_1:
  664.     in    al,dx
  665.     add    ah,al
  666.     inc    dx
  667.     stosb
  668.     loop    init_card_1
  669.     in    al,dx            ;now get the checksum.
  670.     xor    ah,al            ;add it in.
  671.     cmp    ah,-1            ;now it should have all ones set.
  672. ;ugh.  The checksum was botched on some boards, so we can't use it.
  673. ;    jne    init_card_2        ;did it match?  Nope, return error.
  674.     inc    dx
  675.     in    al,dx            ;get the hardware revision number.
  676.  
  677.     test    sys_features,MICROCHANNEL    ;ISA or MCA?
  678.     jne    is_16bit        ;MCA - all MCA cards are 16-bit cards.
  679.     test    al,80h            ;16-bit system?
  680.     je    check_16bit
  681. is_16bit:
  682.     or    endcfg,ENDCFG_WTS    ;yes, use word transfer mode.
  683.  
  684. check_16bit:
  685.  
  686.     mov    bx,offset MCA_name_list        ;assume MCA
  687.     test    sys_features,MICROCHANNEL    ;ISA or MCA?
  688.     jne    check_board_name        ;MCA.
  689.     mov    bx,offset ISA_name_list        ;otherwise ISA.
  690. check_board_name:
  691.     mov    si,[bx]            ;get a pointer to a string.
  692.     add    bx,2
  693.     cmp    byte ptr [si],-1    ;is this the end?
  694.     je    check_board_found
  695.     cmp    al,[si]            ;is this the right one?
  696.     jne    check_board_name
  697. check_board_found:
  698.     inc    si            ;skip the board revision number.
  699.  
  700.     mov    dx,offset this_board_msg
  701.     mov    ah,9
  702.     int    21h
  703.  
  704.     mov    ax,ds            ;copy the driver name to where
  705.     mov    es,ax            ;  we need it.
  706.     mov    di,offset driver_name+3
  707. check_board_copy:
  708.     lodsb
  709.     stosb
  710.     or    al,al
  711.     je    check_board_done_print
  712.     call    chrout            ;print the character.
  713.     jmp    check_board_copy
  714. check_board_done_print:
  715.     lodsb                ;copy the driver type number over
  716.     mov    driver_type,al
  717.     mov    al,CR
  718.     call    chrout
  719.     mov    al,LF
  720.     call    chrout
  721.  
  722.     clc
  723.     ret
  724. init_card_2:
  725.     stc
  726.     ret
  727.  
  728.  
  729.     public    print_parameters
  730. print_parameters:
  731. ;echo our command-line parameters
  732.     mov    di,offset int_no
  733.     mov    dx,offset int_no_name
  734.     call    print_number
  735.     mov    di,offset io_addr
  736.     mov    dx,offset io_addr_name
  737.     call    print_number
  738.     ret
  739.  
  740. code    ends
  741.  
  742.     end
  743.